forked from mono/mono
-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Memoryprofiler] Exposing required mono API for backend migration #1206
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
realek
changed the title
Memoryprofiler exposing required mono API
[Preview][Memoryprofiler] Exposing required mono API for backend migration
Jul 12, 2019
joncham
reviewed
Jul 12, 2019
…n logic over all initialized classes in the VM
…l terminated chunks. A good example for this can be using a preallocated instance of core::string as user_data for the callback which will then append onto the preallocated string
…emory blocks from the VM heap added mono_unity_domain_mempool_chunk_foreach in order to report memory blocks inside the current domain's memory pool added mono_unity_root_domain_mempool_chunk_foreach in order to report memory blocks inside the root domain's memory pool added mono_unity_assembly_mempool_chunk_foreach in order to report memory blocks inside an assembly's image's memory pool added mono_unity_class_get_data_size in order to return static field data size for a MonoClass added mono_unity_class_get_static_field_data in order to access static fields memory for a given MonoClass added mono_unity_class_field_is_literal in order to find out if the attributes added mono_unity_start/stop_gc_world() in order to control the GC world state added mono_unity_gc_heap_foreach in order to report each allocated GC heap section added mono_unity_gchandles_foreach_get_target in order to report all gc handle targets tracked by the garbage collector added mono_unity_object_header_size in order to report mono object header size added mono_unity_array_object_header_size in order to report mono array object header size added mono_unity_offset_of_array_length/bounds_in_array_object_header in order to report the offset of the length/bounds of the array within the header added mono_unity_allocation_granularity in order to report the minimum allocation granulariy inside the vm added mono_unity_get_name_full_chunked in order to extract a types name in chunks added mono_unity_type_is_static in order to report if the given type is static added mono_unity_type_is_pointer_type in order to report if the given type is a pointer type
realek
force-pushed
the
memoryprofiler/exposing_mono_API
branch
from
July 16, 2019 15:10
403fd74
to
ebfcd51
Compare
realek
changed the title
[Preview][Memoryprofiler] Exposing required mono API for backend migration
[Memoryprofiler] Exposing required mono API for backend migration
Jul 16, 2019
realek
commented
Jul 16, 2019
…or mono_unity_class_for_each
joncham
reviewed
Jul 19, 2019
finally green wooop ! ^_^ |
joncham
approved these changes
Jul 29, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR focuses on either exposing or adding new mono functionality in order to allow the Profiler team to fully migrate the memory profiler backend from inside the VM.
It's sister PR: https://github.cds.internal.unity3d.com/unity/il2cpp/pull/446 on the IL2Cpp repo will handle feature parity in between the two back-ends
Preview PR with embedded backends at: https://ono.unity3d.com/unity/unity/pull-request/89971/_/profiler/memory/streaming_snapshot
-> A lot of the changes are the CLang format kicking in...can't really do much about that <-
exposed/new functions as copied from the main repo branch:
Note: MonoDataFunc define is the same signature as GFunc from the mono repo
DO_API(void, mono_unity_image_set_mempool_foreach, (MonoDataFunc callback, void* userdata))
DO_API(void, mono_unity_root_domain_mempool_chunk_foreach, (MonoDataFunc callback, void* userdata))
DO_API(void, mono_unity_domain_mempool_chunk_foreach, (MonoDomain* domain, MonoDataFunc callback, void* userData))
DO_API(void, mono_unity_assembly_mempool_chunk_foreach, (MonoAssembly* assembly, MonoDataFunc callback, void* userData))
DO_API(void, mono_unity_gc_heap_foreach, (MonoDataFunc callback, void* userData))
DO_API(void, mono_unity_gc_handles_foreach_get_target, (MonoDataFunc callback, void* userData))
DO_API(uint32_t, mono_unity_object_header_size, ())
DO_API(uint32_t, mono_unity_array_object_header_size, ())
DO_API(uint32_t, mono_unity_offset_of_array_length_in_array_object_header, ())
DO_API(uint32_t, mono_unity_offset_of_array_bounds_in_array_object_header, ())
DO_API(uint32_t, mono_unity_allocation_granularity, ())
DO_API(uint32_t, mono_unity_class_get_data_size, (MonoClass* klass))
//Non alocating type get name variant, can be used with a preallocated core::string
DO_API(void, mono_unity_type_get_name_full_chunked, (MonoType* type, MonoDataFunc appendCallback, void* userData))
DO_API(MonoVTable*, mono_unity_class_try_get_vtable, (MonoDomain domain, MonoClass klass)) //current get VTable tries to create it, if it does not exist
DO_API(gboolean, mono_unity_type_is_pointer_type, (MonoType type))
DO_API(gboolean, mono_unity_type_is_static,(MonoType type))
DO_API(gboolean, mono_unity_class_field_is_literal, (MonoClassField field))
DO_API(void, mono_unity_vtable_get_static_field_data, (MonoVTable* vTable))
DO_API(void, mono_unity_class_for_each, (MonoClassFunc callback, void* userData))
// used to stop/start the GC world as the alternative would require allocating a state and using the
// liveness methods already present in the codebase
DO_API(void, mono_unity_stop_gc_world, ())
DO_API(void, mono_unity_start_gc_world, ())